package com.example.demo.controller;

import com.example.demo.entity.ResponseResult;
import com.example.demo.entity.Supermarket;
import com.example.demo.service.SupermarketService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/supermarket")
@Api(tags = "超市实体类接口")
public class SupermarketController {

    @Resource
    private SupermarketService supermarketService;

    @GetMapping
    @ApiOperation(value = "超市详细信息查询")
    public ResponseResult getMessage(){
        return supermarketService.getMessage();
    }

    @PostMapping
    @ApiOperation(value = "更新超市实体类信息")
    public ResponseResult updateSupermarket(@RequestBody Supermarket supermarket){
        return supermarketService.updateSupermarket(supermarket);
    }

    @PutMapping
    @ApiOperation(value = "新增超市实体类信息")
    public ResponseResult saveSupermarket(@RequestBody Supermarket supermarket){
        return supermarketService.saveSupermarket(supermarket);
    }

}
